/**
 * querystring.parse 将链接上的a=2&b=2参数转换成对象
 */

const http = require('http')
const querystring = require('querystring')

const server = http.createServer((req, res) => {
  const { method, url} = req
  const queryObj = querystring.parse(url.split('?')[1])
  console.log('url --- ', url)
  console.log('queryObj --- ', queryObj)
  // res.end('come on !!!')
  res.end(JSON.stringify(queryObj))
})


server.listen(8000)
console.log('监听端口8000: http://192.168.10.51:8000')